import {
  Column,
  DeleteDateColumn,
  Entity,
  Index,
  PrimaryGeneratedColumn,
  UpdateDateColumn,
} from 'typeorm';

// @Index('idx_dict_code', ['dictCode'], {})
@Entity('sys_dict')
export class SysDict {
  @PrimaryGeneratedColumn({ type: 'bigint', name: 'id', comment: '主键 ' })
  id: string;

  @Column('varchar', {
    name: 'dict_code',
    nullable: true,
    comment: '类型编码',
    length: 50,
  })
  dictCode: string;

  @Column('varchar', {
    unique: true,
    name: 'name',
    nullable: true,
    comment: '类型名称',
    length: 50,
  })
  name: string;

  @Column('int', {
    name: 'status',
    nullable: true,
    comment: '状态(0:正常;1:禁用)',
    default: () => "'0'",
  })
  status: number | null;

  @Column('varchar', {
    name: 'remark',
    nullable: true,
    comment: '备注',
    length: 255,
  })
  remark: string | null;

  @UpdateDateColumn({
    name: 'create_time',
    nullable: true,
    comment: '创建时间',
  })
  createTime: Date | null;

  @Column('bigint', { name: 'create_by', nullable: true, comment: '创建人ID' })
  createBy: string | null;

  @UpdateDateColumn({
    name: 'update_time',
    nullable: true,
    comment: '更新时间',
  })
  updateTime: Date | null;

  @Column('bigint', { name: 'update_by', nullable: true, comment: '修改人ID' })
  updateBy: string | null;

  @DeleteDateColumn({
    name: 'is_deleted_weird',
    nullable: true,
    comment: '是否删除(1-删除，0/null -未删除1)',
    default: () => null,
  })
  isDeleted: Date | null;

  @Column('datetime', { name: 'deleted_at', nullable: true })
  deletedAt: Date | null;
}
